﻿using Code;
using HeerCards;
using HeerCards.Info;
using LitJson;
using System;
using System.ComponentModel;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Xml.Serialization;

namespace github.heerheer.card2.UI
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public static string cqDirectory { get; set; } = AppMain.Common?.AppDirectory??"";


        public static string getGlobalsettingPath()
        {
            return cqDirectory + "GobalSettings.json";
        }

        public static string getPoolPath(string poolname)
        {
            return cqDirectory + $"pools\\{poolname}.json";
        }
        public static string getImagePath()
        {
            return AppMain.Common.AppDirectory.Replace("app\\github.heerheer.card2", "image\\card2");
        }
        public static void SavePool(HCPool pool)
        {
            var path = getPoolPath(pool.PoolName);
            if (!File.Exists(path))
            {
                File.Create(path).Close();
            }
            var json = JsonMapper.ToJson(pool);
            var filename = "";
            var ErrStrs = "/\\?*<>|";
            File.WriteAllText(path, json);
        }

    }
}
